﻿using FastDevTemplate.DataAccess;
using FastDevTemplate.Service.Event;
using FastDevTemplate.Service.Interface;
using Microsoft.Extensions.DependencyInjection;

namespace FastDevTemplate.Service;

public static class FastDevTemplateServiceExtensions
{
    public static IServiceCollection AddFastDevTemplateService(
        this IServiceCollection services)
    {
        services.AddDbContext<FastDevTemplateDbContext>();
        services.AddTransient<ILogService, LogService>();
        // services.AddSingleton<ILogService, LogService>();
        services.AddScoped<IUserService, UserService>();
        services.AddScoped<IRoleService, RoleService>();
        services.AddScoped<IPermissionService, PermissionService>();
        services.UseUserLogEvent();
        return services;
    }
}